package com.bw.kf.all2211a.seatch

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.bw.kf.mvvm.base.BaseRepo
import com.bw.kf.mvvm.entity.ProductEntity
import com.bw.kf.mvvm.entity.SearchEntity
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import kotlinx.coroutines.launch
import retrofit2.http.Query

class SearchViewMode:BaseRepo() {
    val success=MutableLiveData<ProductEntity>()
    val fall=MutableLiveData<String>()
    fun search(cid:Int,
               keyword:String,
               limit:Int,
               news:Boolean,
               page:Int,
               priceOrder:String,
               salesOrder:String){
     viewModelScope.launch {
          try {
                        success.postValue(aPiText.Search(cid,keyword,limit,news,page,priceOrder,salesOrder))
                    }catch (e:Exception) {
                        fall.postValue(e.message)
                    }
     }
    }

}